﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using BUS;
using DTO;

public partial class DienThoai : System.Web.UI.Page
{

    String connectstring = ConfigurationManager.ConnectionStrings["I_Group_WebConnectionString"].ToString();
  //  SqlConnection sqlcon;
  //  DataTable dt;
  //  SqlDataAdapter da;

    public void LoadSanPhamDienThoai()
    {
        //dt = new DataTable();
        //sqlcon = new SqlConnection(connectstring);
        //String sql_select = "SELECT SAN_PHAM.ID, SAN_PHAM.MaDanhMucSanPham, SAN_PHAM.TenSanPham, SAN_PHAM.GiaBanHienTai, SAN_PHAM.HinhSanPham, SAN_PHAM.DoUuTien, SAN_PHAM.MaHangSanXuat, SAN_PHAM.SoLuotXem, SAN_PHAM.SoLuotMua, DANH_MUC_SAN_PHAM.ID AS Expr1, DANH_MUC_SAN_PHAM.MaNhomDanhMucSanPham, DANH_MUC_SAN_PHAM.TenDanhMucSanPham FROM SAN_PHAM INNER JOIN DANH_MUC_SAN_PHAM ON SAN_PHAM.MaDanhMucSanPham = DANH_MUC_SAN_PHAM.ID WHERE (DANH_MUC_SAN_PHAM.MaNhomDanhMucSanPham = 2)";
        //da = new SqlDataAdapter(sql_select, connectstring);
        //da.Fill(dt);
        //CollectionPager2.PageSize = 15;
        //CollectionPager2.DataSource = dt.DefaultView;
        //CollectionPager2.BindToControl = DataList_SanPhamDienThoai;
        //DataList_SanPhamDienThoai.DataSource = CollectionPager2.DataSourcePaged;

        //Sua phan nay

        List<SanPhamDTO> listdt = SanPhamBUS.LayDanhSachNhomDanhMucSanPham(2);
        

        CollectionPager2.PageSize = 15;
        CollectionPager2.DataSource = listdt;
        CollectionPager2.BindToControl = DataList_SanPhamDienThoai;
        DataList_SanPhamDienThoai.DataSource = CollectionPager2.DataSourcePaged;


    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadSanPhamDienThoai();
        }
     
       
        

    }
    protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {

    }
}
